Skip to content

Basic Information

Since 2.0.4

Development Maven

c
repositories {
    maven { url = "https://maven.firstdark.dev/snapshots" } // LDLib2, Photon2
}

dependencies {
    // LDLib2
    implementation("com.lowdragmc.ldlib2:ldlib2-neoforge-${minecraft_version}:${ldlib2_version}:all") { transitive = false }
    compileOnly("org.appliedenergistics.yoga:yoga:1.0.0")

    // Photon2
    implementation("com.lowdragmc.photon:photon-neoforge-${minecraft_version}:${photon2_version}") { transitive = false }
}

latest version

ldlib2 mavenphoton maven


How to load and use the effect files?

java
FX fx = FXHelper.getFX(ResourceLocation.parse("photon:fire"));
// bind it to a block
new BlockEffectExecutor(fx, level, pos).start();
// bind it to an entity
new EntityEffectExecutor(fx, level, entity, AutoRotate.NONE).start();

Implement your ownIEffectExecutor to manage the lifecycle of your photon effects.

Sometimes, you wanna control the effect you have with additional logic. You can implement the IEffectExecutor and do what you want.

java
public interface IEffectExecutor {

    Level getLevel();

    /**
     * update each FX objects during their duration, per tick. Execute low frequency logic here.
     * <br>
     * e.g., kill particle
     * @param fxObject fx object
     */
    default void updateFXObjectTick(IFXObject fxObject) {
    }

    /**
     * update each FX objects during rendering, per frame. Execute high frequency logic here.
     * <br>
     * e.g., update emitter position, rotation, scale
     * @param fxObject fx object
     * @param partialTicks partialTicks
     */
    default void updateFXObjectFrame(IFXObject fxObject, float partialTicks) {

    }

    default RandomSource getRandomSource() {
        return getLevel().random;
    }
}

Check the ExampleExecutor tab above to see how it works.

java
FX fx = FXHelper.getFX(ResourceLocation.parse("photon:fire"));
var executor = new ExampleExecutor(fx, level);
executor.emit();

Released under the MIT License.